import java.util.Scanner;
//P8772 [蓝桥杯 2022 省 A] 求和
public class test4 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        long ret = 0;

        long[] arr = new long[n];
        //读入数据
        for (int i = 0; i < n; i++) {
            arr[i] = scan.nextInt();
        }
        //预处理一个前缀和数组
        long[] arr1 = new long[n];
        int sum = 0;
        for(int i = 1;i<arr.length;i++){
            sum +=arr[i];
        }
        arr1[0] = sum;
        for(int i = 1;i<arr.length;i++){
            arr1[i] = arr1[i-1] - arr[i];
        }

        for(int i = 0;i<arr.length;i++){
            ret += arr[i]*arr1[i];
        }
        System.out.println(ret);
    }
}
